public class CheckerApplet extends java.applet.Applet {
    int squareSize = 50;

    // 初始化默认大小
    @Override
    public void init() {
        String squareSizeParam = getParameter("squareSize");
        parseSquareSize(squareSizeParam);
        String colorParam = getParameter("color");
        java.awt.Color fg = parseColor(colorParam);
        setBackground(java.awt.Color.black);
        setForeground(fg);
    }

    private void parseSquareSize(String param) {
        if (param == null) return;
        try {
            squareSize = Integer.parseInt(param);
        } catch (Exception e) {
            // 保留默认值
            e.printStackTrace();
        }
    }

    private java.awt.Color parseColor(String param) {

        return java.awt.Color.getColor(param);

    }

    @Override
    public void paint(java.awt.Graphics g) {
    }
}
